package utilBean;
import java.util.List;

import org.primefaces.event.SelectEvent;

import Controller.SessionUtil;
import dao.ActivoDAO;
import models.Activo;


public class ActivoTable {
	
	private Activo selected_activo;
	
	public List<Activo> obtener_activos(){
		return ActivoDAO.findAllByArea(SessionUtil.getIdArea());
	}

	public Activo getSelected_activo() {
		return selected_activo;
	}

	public void setSelected_activo(Activo selected_activo) {
		this.selected_activo = selected_activo;
	}
	
	public void onRowSelect(SelectEvent event){
		selected_activo = (Activo) event.getObject();
	}
	
	public void onRowUnselect(SelectEvent event){
		
	}
	
	public void new_activo(){
		selected_activo=null;
		SessionUtil.redirectTo("/user/new_activo.xhtml");
	}
}
